﻿using LightweightApp.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace LightweightApp.Service
{
    public class BookService : ApplicationService, IBookService
    {
        private readonly IRepository<Book, Guid> _repository;
        
        public BookService(IRepository<Book,Guid> repository)
        {
            this._repository = repository;
        }
        public async Task<string> CreateAsync(string name)
        {
            var book = await _repository.InsertAsync(new Book { 
                Name = name
            });
            return book.Name;
        }
    }
}
